from django.contrib import admin
from .models import Book
from .models import Author

# Register your models here.

#Book
class BookManager(admin.ModelAdmin):
    #列表页显示哪些字段的列
    list_display = ['id','title','pub','price']
    #list_display中的字段  哪些可以链接到修改页
    list_display_links = ['title']
    #添加过滤器
    list_filter = ['pub']
    #添加搜索框【模糊查询】
    search_fields = ['title']
    #添加可在列表页编辑的字段
    list_editable = ['price']

#Auth
class AuthorManager(admin.ModelAdmin):
    #列表页显示哪些字段的列
    list_display = ['name','age','email']
    #添加可在列表页编辑的字段
    list_editable = ['age','email']

admin.site.register(Book,BookManager)
admin.site.register(Author,AuthorManager)



